home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #9 / Amiga Plus CD - 2004 - No. 09.iso / amigaplus / tools / dev_libs / feelin040718 / demos / demo.e < prev    next >
Text File  |  2004-08-03  |  15KB  |  445 lines

  1. OPT PREPROCESS
  2.  
  3. MODULE 'feelin','libraries/feelin','a4',
  4.        'utility/hooks',
  5.        'graphics/gfxmacros','graphics/rastport'
  6.  
  7. PROC main()
  8.    DEF app,win,
  9.        p1,g1,myback[16]:STRING,hook:hook
  10.  
  11.    ->    grp1,grp2,grp3,b1,b2,b3, p1,p2,p3,p4, g1,g2,g3, s1, i=NIL,inc=TRUE
  12.  
  13.    sys_SGlob()
  14.  
  15.    hook.entry := {draw_hook}
  16.    hook.data  := NIL
  17.  
  18.    StringF(myback,'H:%08.lx',hook)
  19.  
  20.    IF feelinbase := OpenLibrary('feelin.library',0)
  21.       app := AppObject,
  22.          FA_Application_Base,'DEMO',
  23.  
  24.          Child, win := WindowObject,
  25.             FA_Window_Title, 'Feelin : Demo',
  26.             FA_Window_Open,   TRUE,
  27.  
  28.             Child, VGroup,
  29.                Child, Page,
  30. ->PROC About
  31.                   Child, F_NewObjA('Crawler',[FA_Group_Title, 'About', GaugeFrame, 'FA_Crawler_Delay',40,
  32.                      Child, TextObject,
  33.                         FA_Font,                   'Helvetica/11',
  34.                         FA_Back,                   myback,
  35.                         FA_Inner_Left,             20,
  36.                         FA_Inner_Top,              5,
  37.                         FA_Inner_Right,            20,
  38.                         FA_Inner_Bottom,           5,
  39.                         FA_ChainToCycle,           FALSE,
  40.                         FA_Text,                   {__CrawText},
  41.                         End,
  42.                   End,
  43. ->ENDPROC
  44. ->PROC Objects
  45.                   Child, Page, FA_Group_Title, 'Object',
  46. ->PROC Objects / Buttons
  47.                      Child, HGroup, FA_Group_Title,'Simple Buttons', GroupFrame, FA_Frame_Title,'Buttons with differents Inputs',
  48.                         Child, button('_Immediate',FV_InputMode_Immediate),
  49.                         Child, button('_Toggle',FV_InputMode_Toggle),
  50.                         Child, button('_Release',FV_InputMode_Release),
  51.                      End,
  52. ->ENDPROC
  53. ->PROC Objects / Gauges
  54.                      Child, HGroup, FA_Group_Title, 'Gauges',
  55.                         Child, VGroup,
  56.                            Child, Gauge(TRUE,0,100, 25),
  57.                            Child, Gauge(TRUE,0,100, 50),
  58.                            Child, Gauge(TRUE,0,100, 75),
  59.                            Child, Gauge(TRUE,0,100,100),
  60.                            Child, Gauge(TRUE,0,100,  0),
  61.                         End,
  62.  
  63.                         Child, Bar,
  64.  
  65.                         Child, VGroup, FA_SetMax,FV_SetMaxH,
  66.                            Child, Gauge(TRUE,0,100,  0),
  67.                            Child, Gauge(TRUE,0,100,100),
  68.                            Child, Gauge(TRUE,0,100,  0),
  69.                            Child, Gauge(TRUE,0,100,100),
  70.                         End,
  71.  
  72.                         Child, Bar,
  73.  
  74.                         Child, HGroup, FA_Weight, 25,
  75.                            Child, Gauge(FALSE,0,100,  25),
  76.                            Child, Gauge(FALSE,0,100,  50),
  77.                            Child, Gauge(FALSE,0,100,  75),
  78.                            Child, Gauge(FALSE,0,100, 100),
  79.                         End,
  80.                      End,
  81. ->ENDPROC
  82. ->PROC Objects / Props
  83.                      Child, HGroup, FA_Group_Title, 'Proportionals',
  84.                         Child, VGroup,
  85.                            Child, Prop(TRUE,32,16,0),
  86.                            Child, Prop(TRUE,32,08,0),
  87.                            Child, Prop(TRUE,32,04,0),
  88.                            Child, Prop(TRUE,32,02,0),
  89.                         End,
  90.  
  91.                         Child, VGroup, FA_SetMax,FV_SetMaxH,
  92.                            Child, Prop(TRUE,32,16,0),
  93.                            Child, Prop(TRUE,32,08,0),
  94.                            Child, Prop(TRUE,32,04,0),
  95.                            Child, Prop(TRUE,32,02,0),
  96.                         End,
  97.  
  98.                         Child, HGroup,
  99.                            Child, Prop(FALSE,32,16,0),
  100.                            Child, Prop(FALSE,32,08,0),
  101.                            Child, Prop(FALSE,32,04,0),
  102.                            Child, Prop(FALSE,32,02,0),
  103.                         End,
  104.                      End,
  105. ->ENDPROC
  106. ->PROC Objects / Sliders
  107.                      Child, HGroup, FA_Group_Title, 'Sliders',
  108.                         Child, VGroup, FA_SetMax,FV_SetMaxH,
  109.                            Child, SliderObject, FA_Horizontal,TRUE, SliderFrame,FA_Back,FI_Shine,  'FA_Numeric_Max',10, 'FA_Numeric_Value', 0, End,
  110.                            Child, SliderObject, FA_Horizontal,TRUE, SliderFrame,FA_Back,FI_Fill,   'FA_Numeric_Max',10, 'FA_Numeric_Value', 5, End,
  111.                            Child, SliderObject, FA_Horizontal,TRUE, SliderFrame,FA_Back,FI_Shadow, 'FA_Numeric_Max',10, 'FA_Numeric_Value',10, End,
  112.  
  113.                            Child, Bar,
  114. ->                           Child, AreaObject, FA_Back,FI_Highlight, FA_FixHeight,3, End,
  115.  
  116.                            Child, SliderObject, FA_Horizontal,TRUE, SliderFrame,FA_Back,FI_Dark, 'FA_Numeric_Max',  3, 'FA_Numeric_Min',    1, 'FA_Numeric_Value',  1, End,
  117.                            Child, SliderObject, FA_Horizontal,TRUE, SliderFrame,FA_Back,FI_Highlight, 'FA_Numeric_Max',  3, 'FA_Numeric_Min', -3, 'FA_Numeric_Value',  0, End,
  118.                         End,
  119.  
  120.                         Child, Bar,
  121.  
  122.                         Child, HGroup, FA_Weight,50,
  123.                            Child, SliderObject, FA_ChainToCycle,FALSE, SliderFrame,FA_Back,FI_Dark,  'FA_Numeric_Max',  32, End,
  124.                            Child, SliderObject, SliderFrame,FA_Back,FI_Shine, 'FA_Numeric_Max',  3, 'FA_Numeric_Min', -3, End,
  125.                         End,
  126.                      End,
  127. ->ENDPROC
  128.                   End,
  129. ->ENDPROC
  130. ->PROC Groups
  131.                   Child, Page, FA_Group_Title,'Groups',
  132.                      Child, HGroup, FA_Group_Title,'Types', FA_Group_SameSize,TRUE,
  133.                         Child, HGroup, GroupFrame, FA_Frame_Title, 'Horizontal',
  134.                            Child, rectObj(),
  135.                            Child, rectObj(),
  136.                            Child, rectObj(),
  137.                         End,
  138.  
  139.                         Child, VGroup, GroupFrame, FA_Frame_Title, 'Vertical',
  140.                            Child, rectObj(),
  141.                            Child, rectObj(),
  142.                            Child, rectObj(),
  143.                         End,
  144.  
  145.                         Child, VGroup, GroupFrame, FA_Frame_Title, 'Array', FA_Group_Rows,3,
  146.                            Child, rectObj(), Child, rectObj(), Child, rectObj(),
  147.                            Child, rectObj(), Child, rectObj(), Child, rectObj(),
  148.                            Child, rectObj(), Child, rectObj(), Child, rectObj(),
  149.                         End,
  150.                      End,
  151.  
  152.                      Child, VGroup, FA_Group_Title, 'Layout',
  153.                         Child, HGroup, GroupFrame, FA_Frame_Title, 'Different Weights',
  154.                            Child, textObj( '25 kg',[FA_Weight, 25, NIL]),
  155.                            Child, textObj( '50 kg',[FA_Weight, 50, NIL]),
  156.                            Child, textObj( '75 kg',[FA_Weight, 75, NIL]),
  157.                            Child, textObj('100 kg',[FA_Weight,100, NIL]),
  158.                         End,
  159.  
  160.                         Child, HGroup, GroupFrame, FA_Frame_Title, 'Fixed & Variable Sizes',
  161.                            Child, textObj('fixed',[FA_SetMax,FV_SetMaxW, NIL]),
  162.                            Child, textObj('free'),
  163.                            Child, textObj('fixed',[FA_SetMax,FV_SetMaxW, NIL]),
  164.                            Child, textObj('free'),
  165.                            Child, textObj('fixed',[FA_SetMax,FV_SetMaxW, NIL]),
  166.                         End,
  167.  
  168.                         Child, HGroup, GroupFrame, FA_Frame_Title, 'Relative Sizes', FA_Group_RelSizing,TRUE,
  169.                            Child, textObj('1'),
  170.                            Child, textObj('12'),
  171.                            Child, textObj('123'),
  172.                            Child, textObj('1234'),
  173.                            Child, textObj('12345'),
  174.                         End,
  175.  
  176.                         Child, HGroup, GroupFrame, FA_Frame_Title, 'Same Width', FA_Group_SameWidth,TRUE,
  177.                            Child, textObj('1'),
  178.                            Child, textObj('12'),
  179.                            Child, textObj('123'),
  180.                            Child, textObj('1234'),
  181.                         End,
  182.                      End,
  183.                   End,
  184. ->ENDPROC
  185. ->PROC Special
  186.                   Child, Page, FA_Group_Title,'Special',
  187. ->PROC Special / Rasters
  188.                      Child, VGroup, FA_Group_Title,'Rasters', FA_Group_VSpacing, 0,
  189.                         Child, HGroup, FA_Group_HSpacing, 0,
  190.                            Child, rast(FI_Highlight),
  191.                            Child, rast(FI_Shine_Highlight),
  192.                            Child, rast(FI_HalfShine_Highlight),
  193.                            Child, rast(FI_Fill_Highlight),
  194.                            Child, rast(FI_HalfShadow_Highlight),
  195.                            Child, rast(FI_Shadow_Highlight),
  196.                            Child, rast(FI_HalfDark_Highlight),
  197.                            Child, rast(FI_Dark_Highlight),
  198.                         End,
  199.                         Child, HGroup, FA_Group_HSpacing, 0,
  200.                            Child, rast(FI_Shine),
  201.                            Child, rast(FI_Shine_HalfShine),
  202.                            Child, rast(FI_Shine_Fill),
  203.                            Child, rast(FI_Shine_HalfShadow),
  204.                            Child, rast(FI_Shine_Shadow),
  205.                            Child, rast(FI_Shine_HalfDark),
  206.                            Child, rast(FI_Shine_Dark),
  207.                         End,
  208.  
  209.                         Child, HGroup, FA_Group_HSpacing, 0,
  210.                            Child, rast(FI_HalfShine),
  211.                            Child, rast(FI_HalfShine_Fill),
  212.                            Child, rast(FI_HalfShine_HalfShadow),
  213.                            Child, rast(FI_HalfShine_Shadow),
  214.                            Child, rast(FI_HalfShine_HalfDark),
  215.                            Child, rast(FI_HalfShine_Dark),
  216.                         End,
  217.  
  218.                         Child, HGroup, FA_Group_HSpacing, 0,
  219.                            Child, rast(FI_Fill),
  220.                            Child, rast(FI_Fill_HalfShadow),
  221.                            Child, rast(FI_Fill_Shadow),
  222.                            Child, rast(FI_Fill_HalfDark),
  223.                            Child, rast(FI_Fill_Dark),
  224.                         End,
  225.  
  226.                         Child, HGroup, FA_Group_HSpacing, 0,
  227.                            Child, rast(FI_HalfShadow),
  228.                            Child, rast(FI_HalfShadow_Shadow),
  229.                            Child, rast(FI_HalfShadow_HalfDark),
  230.                            Child, rast(FI_HalfShadow_Dark),
  231.                         End,
  232.  
  233.                         Child, HGroup, FA_Group_HSpacing, 0,
  234.                            Child, rast(FI_Shadow),
  235.                            Child, rast(FI_Shadow_HalfDark),
  236.                            Child, rast(FI_Shadow_Dark),
  237.                         End,
  238.  
  239.                         Child, HGroup, FA_Group_HSpacing, 0,
  240.                            Child, rast(FI_HalfDark),
  241.                            Child, rast(FI_HalfDark_Dark),
  242.                         End,
  243.  
  244.                         Child, rast(FI_Dark),
  245.                      End,
  246. ->ENDPROC
  247. ->PROC Special / Text Engine
  248.                      Child, GroupObject, FA_Group_Title,'Text Engine',
  249.                         Child, TextObject,
  250.                                  FA_ChainToCycle,    FALSE,
  251.                                  FA_SetMax,          FV_SetMaxH,
  252.                                  FA_Text,            {__Text},
  253.                                  FA_SetMin,           FV_SetMinH,
  254.                                  End,
  255.                      End,
  256. ->ENDPROC
  257.                   End,
  258. ->ENDPROC
  259.  
  260.                End,
  261.             End,
  262.          End,
  263.       End
  264.  
  265.       IF app
  266. /*
  267.          F_DoA(b1,FM_Notify,[FA_Pressed,FALSE,p,3,FM_Set,FA_Page_Active,grp1])
  268.          F_DoA(b2,FM_Notify,[FA_Pressed,FALSE,p,3,FM_Set,FA_Page_Active,grp2])
  269.          F_DoA(b3,FM_Notify,[FA_Pressed,FALSE,p,3,FM_Set,FA_Page_Active,grp3])
  270.          F_DoA(p4,FM_Notify,[FA_Prop_First,FV_Notify_Always,p3,3,FM_Set,FA_Prop_First,FV_Notify_Value])
  271.          F_DoA(p3,FM_Notify,[FA_Prop_First,FV_Notify_Always,p2,3,FM_Set,FA_Prop_First,FV_Notify_Value])
  272.          F_DoA(p2,FM_Notify,[FA_Prop_First,FV_Notify_Always,p1,3,FM_Set,FA_Prop_First,FV_Notify_Value])
  273.          F_DoA(g1,FM_Notify,[FA_Numeric_Value,FV_Notify_Always,g3,5,FM_Set,FA_Numeric_Value,FV_Notify_Value,FA_Numeric_Multiply,2])
  274.          F_DoA(g1,FM_Notify,[FA_Numeric_Value,FV_Notify_Always,s1,5,FM_Set,FA_Numeric_Value,FV_Notify_Value,FA_Numeric_Multiply,2])
  275. */
  276.          F_DoA(win,FM_Notify,[FA_Window_CloseRequest,TRUE,app,FM_Application_Shutdown,0])
  277.          F_DoA(app,FM_Application_Run,NIL)
  278.          F_DisposeObj(app)
  279.       ENDIF
  280.  
  281.       CloseLibrary(feelinbase)
  282.    ELSE
  283.       WriteF('Unable to open feelin.library\n')
  284.    ENDIF
  285. ENDPROC
  286.  
  287. PROC textObj(name,tags=NIL)
  288.    RETURN   TextObject,
  289.             FA_ChainToCycle,  FALSE,
  290.             FA_SetMax,        FV_SetMaxH,
  291.             FA_Frame,         'FP_Text_Frame',
  292.             FA_Back,          FI_HalfShadow,
  293.             FA_Text,          name,
  294.             FA_Text_PreParse, '<align=center>',
  295.             2,                tags,
  296.             End
  297. ENDPROC
  298. PROC rectObj()
  299.    RETURN   AreaObject,
  300.             FA_ChainToCycle,  FALSE,
  301.             FA_Frame,         'FP_Text_Frame',
  302.             FA_Back,          FI_HalfShadow,
  303.             End
  304. ENDPROC
  305. PROC rast(rast)
  306.    RETURN   AreaObject,
  307.             FA_ChainToCycle,  FALSE,
  308.             FA_Back,          rast,
  309.             End
  310. ENDPROC
  311. PROC button(label,input)
  312.    RETURN TextObject,
  313.           FA_SetMax,          FV_SetMaxH,
  314.           FA_Frame,           'FP_Button_Frame',
  315.           FA_Font,            'FP_Button_Font',
  316.           FA_Back,            'FP_Button_Back',
  317.           FA_SetMin,          FV_SetMinH,
  318.           FA_InputMode,       input,
  319.           FA_Text,            label,
  320.           FA_Text_PreParse,   '<align=center>',
  321.           End
  322. ENDPROC
  323.  
  324. PROC draw_hook(msg=A1:PTR TO FS_ImageDisplay_HookDraw)
  325.    DEF x1,y1,x2,y2,x3,rp
  326.  
  327.    sys_RGlob()
  328.  
  329.    x1 := msg.region.x1 ; x3 := msg.region.x2 ; x2 := x3 - x1 / 3 + x1
  330.    y1 := msg.region.y1 ; y2 := msg.region.y2 ; rp := msg.render.rport
  331.  
  332.    _APen(msg.render.palette.pens[FV_Pen_HalfShadow]) ; _Boxf(x1,y1,x2,y2)
  333.    _APen(msg.render.palette.pens[FV_Pen_Fill])       ; _Boxf(x2+1,y1,x3,y2)
  334. ENDPROC
  335.  
  336. ->PROC Objects / Strings
  337. /*
  338.                      Child, VGroup, NoFrame, FA_FixedHeight,TRUE,
  339.                         Child, BarTitle('Numeric string'),
  340.                         Child, F_MakeObjA(FO_String,['1234',32],[FA_String_Accept,{__Num}, NIL]),
  341.                         Child, BarTitle('Hexadecimal string'),
  342.                         Child, F_MakeObjA(FO_String,['FF123a',32],[FA_String_Accept,{__Hex}, NIL]),
  343.                         Child, BarTitle('Alphabetic strings & Alignement'),
  344.  
  345.                         Child, HGroup, NoFrame,
  346.                            Child, F_MakeObjA(FO_String,['Lotan is my Lord',80],[FA_String_Reject,{__Num}, FA_String_Format,FV_String_Format_Left,   NIL]),
  347.                            Child, F_MakeObjA(FO_String,['Lotan is my Lord',80],[FA_String_Reject,{__Num}, FA_String_Format,FV_String_Format_Center, NIL]),
  348.                            Child, F_MakeObjA(FO_String,['Lotan is my Lord',80],[FA_String_Reject,{__Num}, FA_String_Format,FV_String_Format_Right,  NIL]),
  349.                         End,
  350.                      End,
  351. */
  352. ->ENDPROC
  353.  
  354. ->PROC Datas
  355. __Text:
  356.    CHAR '<align=center><spacing=2>',
  357.         'Normal text, <pens text=highlight>Highlighted text</pens><br>',
  358.         '<pens style="emboss">Embossed</pens>, <pens style="ghost">Ghost</pens><br>',
  359.         '<pens style="light">Some Light</pens>, <pens style="shadow">Some Shadow</pens><br>',
  360.         '<pens style="glow">Glowing</pens>, <pens up=1 shadow=4>Emboss & Shadow</pens><br>',
  361.         '<i>Italic</i>, <b>Bold</b>, <u>Underlined</u>, Normal, <i><b><u>Mixed</u></b></i><br>',
  362.         '<align=left>A very, very, very long line that will be nicely truncated<br>',
  363.         '<align=center>A very, very, very long line that will be nicely truncated<br>',
  364.         '<align=right>A very, very, very long line that will be nicely truncated',NIL
  365.  
  366. __CrawText:
  367.    CHAR  '<br><align=center>',
  368.          '<pens shadow=shadow text=shine><font face=helvetica size=15>!! <b>Welcome</b> !!</pens><br><br>',
  369.          '<pens shadow=halfshadow><font size=11>Yes, welcome to a brand new world !',
  370.          '<br>',
  371.          '<hr width=60%>',
  372.          '<br>',
  373.          'Well... This is ',
  374.          '<font size=13 color=#FF0000>F',
  375.          '<font         color=#FFCC00>e</font>',
  376.          '<font         color=#66FF00>e</font>',
  377.          '<font         color=#00FF66>l</font>',
  378.          '<font         color=#00CCFF>i</font>',
  379.          '<font         color=#0000FF>n</font></font>, a new<br>',
  380.          '<b>Object Oriented System</b>.',
  381.          '<br>',
  382.          '<br>',
  383.          '<font size=13 color=#FF0000>F',
  384.          '<font         color=#FFCC00>e</font>',
  385.          '<font         color=#66FF00>e</font>',
  386.          '<font         color=#00FF66>l</font>',
  387.          '<font         color=#00CCFF>i</font>',
  388.          '<font         color=#0000FF>n</font></font> ',
  389.          'has been written from scratch.',
  390.          '<br>',
  391.          'It does not use <b>BOOPSI</b><br>',
  392.          'or <u>any</u> other kind of stuff.<br>',
  393.          '<br>',
  394.          '<font size=13 color=#FF0000>F',
  395.          '<font         color=#FFCC00>e</font>',
  396.          '<font         color=#66FF00>e</font>',
  397.          '<font         color=#00FF66>l</font>',
  398.          '<font         color=#00CCFF>i</font>',
  399.          '<font         color=#0000FF>n</font></font> ',
  400.          'is very fast,<br>',
  401.          'easy to use, and very small<br>',
  402.          '(feelin.library is about 24Ko)<br>',
  403.          '<br>',
  404.          '<pens style=glow><font face=helvetica size=13><u>Main Features</u></font></pens><br>',
  405.          'Own Memory Management\n',
  406.          'Servers\n',
  407.          '<b>Dynamic IDs</b> <font size=9px>(no longer static ones)</font>\n',
  408.          'Easy programmer interface\n',
  409.          'Extremely configurable GUI\n',
  410.          'Advanced concepts & OOP\n',
  411.          'Easy debugging\n',
  412.          'Great flexibility\n',
  413.          '<hr width=60%>',
  414.          '<br>',
  415.          '<font size=13 color=#FF0000>F',
  416.          '<font         color=#FFCC00>e</font>',
  417.          '<font         color=#66FF00>e</font>',
  418.          '<font         color=#00FF66>l</font>',
  419.          '<font         color=#00CCFF>i</font>',
  420.          '<font         color=#0000FF>n</font></font> ',
  421.          'has no past,<br>',
  422.          'only future.<br><br><br>',
  423.  
  424.          '<i>Well, I hope ;-)</i>...<br><br><br>',
  425.  
  426.         '<pens shadow=shadow text=shine>E<pens text=halfshine>n</pens><pens text=fill>j</pens><pens text=halfshadow>o</pens><pens text=shadow>y</pens>,<br><br><br>',
  427.         '<font color=#FF00FF>L</font>',
  428.         '<font color=#AA00FF>o</font>',
  429.         '<font color=#5500FF>t</font>',
  430.         '<font color=#0000FF>s</font> ',
  431.         '<font color=#0055FF>o</font>',
  432.         '<font color=#00AAFF>f</font> ',
  433.         '<font color=#00FFFF>l</font>',
  434.         '<font color=#00FFAA>o</font>',
  435.         '<font color=#00FF55>v</font>',
  436.         '<font color=#00FF00>e</font> ',
  437.         '<font color=#55FF00>!</font>',
  438.         '<font color=#AAFF00>!</font>',
  439.         '<font color=#FFFF00>!</font></pens>',
  440.         '<br><br><br><br></font>',NIL
  441.  
  442. __Hex:   CHAR 'ABCDEFabcdef'
  443. __Num:   CHAR '1234567890',0   
  444. ->ENDPROC
  445.